<?php

namespace App\Console\Commands;

use App\Libraries\Payment\WechatPay\WechatPayPayment;
use Illuminate\Console\Command;

class SandboxCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'sandbox';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Sandbox command';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        $orderId = '3023399019900020';
        $openId = 'oEImW6uu1zgLCr-JEGFatzsxOrQk';
        $params = [
            'transactionNo' => $orderId,
            'batchDetailNo' => 'FINx1',
            'transAmount' => 0.3,
            'accountType' => 'WX_ACCOUNT', // @notice:: fixed
            'accountNo' => $openId,
            'outBizNo' => $orderId,
            'notifyUrl' => sprintf('%s/payment/wechat/transfer-callback', config('services.host')),
            'remark' => '金币提现0.3元_Wenzhuan',
        ];
        $result = WechatPayPayment::makeRequest($params);

        // 131000406063106488096182024071886154915518
        dd($result);
    }
}
